<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title><% model(2); %></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="jquery.form.js"></script>
<script type="text/javascript" src="php.js"></script>
<script type="text/javascript" src="config.js"></script>
<script type="text/javascript" src="general.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$('#loading').hide();
		$('form').ajaxForm({
			dataType:  'text',
			beforeSend: function() {
				$('#loading').show();
				$('#status').css('color', '#000000').html('Uploading firmware, please wait..');
			},
			uploadProgress: function(event, position, total, percentComplete) {
				if (percentComplete == 100)
					$('#status').html('Updating firmware, please wait..');
				else
					$('#status').html(sprintf('Uploading firmware: %d%%', percentComplete));
			},
			error: function() {
				$('#loading').hide();
				$('#status').css('color', '#ff0000').html('Firmware update failed.');
			},
			success: function(data) {
				if (data == 'ok') {
					$('#status').css('color', '#008000').html('Firmware update complete, rebooting..');
					setTimeout(function() {
						top.location.reload(true);
					}, 30000);
				}
				else {
					$('#loading').hide();
					$('#status').css('color', '#ff0000').html('Firmware update failed.');
				}
			}
		});
	});
</script>
</head>
<body>
<form method="post" action="fwupdate.cgi" enctype="multipart/form-data">

<table class="main">
<thead>
<tr>
<td>System Setup - Firmware Update</td>
</tr>
</thead>

<tr><td>
<table class="sect">
<tr>
		<th>Product ID:</th><td><% nvram_get("productid"); %></td>
</tr>
<tr>
		<th>Firmware Version:</th><td><% nvram_get("firmver"); %></td>
</tr>
<tr>
		<th>Firmware Release:</th><td><% nvram_dump("../.version",""); %></td>
</tr>
<tr>
<th>Firmware File:</th><td>  
                  <input class="inputSubmit" name="file" size="20" type="file" /></td>
</tr>
<tr>
<th>&nbsp;</th><td><input class="inputSubmit" type="submit" value="Upload" />
&nbsp;<span id="loading"><img src="img/ajax-loader.gif" alt="" />&nbsp;</span><span id="status" style="font-weight: bold;"></span>
</td>
</tr>
</table>
</td></tr>

</table>
</form>
</body>
</html>